package com.jgp.form.model;

import com.jgp.common.persistence.UUIDModel;
import com.jgp.sys.query.Operator;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Type;

import javax.persistence.*;

/**
 * 项目   jgp-cloud-parent
 * 作者   loufei
 * 时间   2019-05-27
 */
@Getter
@Setter
@Entity
@Table(name = "sys_virtual_form_attr")
public class VirtualFormAttr extends UUIDModel {
    /**
     * 表单id
     */
    @Column(name = "form_id",length = 32)
    private String formId;
    
    /**
     * 表单 code
     */
    @Column(name = "form_code",length = 32)
    private String formCode;
    
    /**
     * 字段名称
     */
    @Column(name = "name",length = 50)
    private String name;
    
    /**
     * 字段名称
     */
    @Column(name = "label",length = 50)
    private String label;
    
    /**
     * 默认值
     */
    @Column(name = "value")
    private String value;
    
    /**
     * 字段类型
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "type",length = 20)
    private VirtualFormAttrType type;
    /**
     * 小数位
     */
    @Column(name = "decimal")
    private Integer decimal;
    /**
     * 行数
     */
    @Column(name = "row",length = 3)
    private Integer row;
    /**
     * 宽度
     */
    @Column(name = "col",length = 3)
    private Integer col;
    
    @Column(name = "label_width",length = 10)
    private String labelWidth;
    
    /**
     * 下拉类型
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "drop_type",length = 20)
    private VirtualFormAttrDropType dropType;
    /**
     * 排序
     */
    @Column(name = "sort",length = 3)
    private Integer sort;
    
    /**
     * 模型
     */
    @Column(name = "model")
    private String model;
    
    /**
     * 模型
     */
    @Column(name = "mapper_name")
    private String mapperName;
    
    /**
     * 列表数据源
     */
    @Column(name = "data_source")
    private String dataSource;
    
    /**
     * 是否必填
     */
    @Type(type = "yes_no")
    @Column(name = "required")
    private Boolean required;
    
    
    /**
     * 是否在列表中显示
     */
    @Type(type = "yes_no")
    @Column(name = "in_grid")
    private Boolean inGrid;
    
    /**
     * 是否是查询参数
     */
    @Type(type = "yes_no")
    @Column(name = "for_search")
    private Boolean forSearch;
    
    /**
     * 查询表单中的宽度
     */
    @Column(name = "query_col",length = 3)
    private Integer queryCol;
    
    /**
     * 查询操作类型
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "query_operator",length = 20)
    private Operator queryOperator;
    
}
